<template>
    <v-modal v-model:show="show" title="上传照片">
        <div class="img-cropper">
            <VueCropper ref="cropper" v-bind="option" style="height: 300px" />
            <div class="img-cropper-action">
                <n-upload>
                    <n-button>选择照片</n-button>
                </n-upload>
                <n-button type="primary">上传</n-button>
            </div>
        </div>
    </v-modal>
</template>
<script setup>
import { ref } from 'vue'
import VModal from '@/common/VModal/index.vue'
import 'vue-cropper/dist/index.css'
import { VueCropper } from 'vue-cropper'

const show = ref(false)
const cropper = ref(null)

const option = ref({
    img: '',
    outputSize: 1,
})

const open = () => {
    show.value = true
}

defineExpose({
    open,
})
</script>
<style lang="less" scoped>
.img-cropper {
    width: 560px;
    &-action {
        margin-top: 16px;
        display: flex;
        align-items: center;
        justify-content: space-between;
    }
}
</style>
